<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 200px;
      height: 300px;
    }
    .sticky {
      width: 100px;
      height: 100px;
      background-color: red;
      position: sticky;
      top: 10px;

    }
    .box1 {
      height: 400px;
      width: 200px;
      overflow:scroll;
    }
  </style>
</head>
<body>
  <div class="box">1</div>
  <div class="box">2
    <div class="sticky">sticky</div>
  </div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box1">
    <div class="box">1</div>
    <div class="box">2
      <div class="sticky">sticky</div>
    </div>
    <div class="box">3</div>
    <div class="box">4</div>
  </div>
  <div class="box">4</div>
</body>
</html>